<template>
    <div>
        <h3>demo1</h3>
        <span>n:{{ n }}</span>
        <span>m:{{ m }}</span>
        <span>c:{{ student.ccc }}</span>
        <button @click="addN">n+1</button>
        <button @click="setCCC">n+1</button>
    </div>
</template>
<script>
import { mapState, mapMutations } from 'vuex'
export default {
    //computed:mapState(['n','m']),
    computed: {
        // n:function(){
        //     return this.$store.state.n
        // },
        ...mapState(['n', 'm', 'student'])

    },
    methods: {
        // add(){
        //     // this.n++;
        //     // sessionStorage.setItem('n',this.n);
        //     this.$store.commit('addN')
        // }
        ...mapMutations(['addN','setCCC']),
        // ...mapMutations({
        //     setCCC: {
        //         type: 'setCCC',
        //         amount: 5
        //     }
        // }),
        // setCCC() {
        //     this.$store.commit('setCCC', 4)
        // }
    },
    created() {
        console.log(this.$store)
    }
}
</script>